<?php 
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header', 'admin');
?>
<div class="pad-lr-10">
<form name="myform" action="?m=pointcard&c=admin_pointcard&a=listorder" method="post">
<div class="table-list">
    <table width="100%" cellspacing="0">
        <thead>
            <tr>
			<th align="center"><?php echo L('pointcard_card_no')?></th>
			<th width="68" align="center"><?php echo L('pointcard_card_pwd')?></th>
			<th width='80' align="center"><?php echo L('pointcard_card_value')?></th>
			<th width='68' align="center"><?php echo L('pointcard_owner')?></th>
			<th width="80" align="center"><?php echo L('pointcard_addtime')?></th>
			<th width="80" align="center"><?php echo L('pointcard_endtime')?></th>
			<th width="80" align="center"><?php echo L('pointcard_updatetime')?></th>
			<th width="50" align="center"><?php echo L('pointcard_admin')?></th>
			<th width="69" align="center"><?php echo L('operations_manage')?></th>
            </tr>
        </thead>
    <tbody>
 <?php 
if(is_array($data)){
	foreach($data as $pointcard){
?>   
	<tr>
	<td><?php echo $pointcard['card_sn']?></td>
	<td align="center"><?php echo $pointcard['card_pwd']?></td>
	<td align="center"><?php echo $pointcard['card_value']?></td>
	<td align="center"><?php echo $pointcard['owner_username']?></td>
	<td align="center"><?php echo $pointcard['format_addtime']?></td>
	<td align="center"><?php echo $pointcard['format_endtime']?></td>
	<td align="center"><?php echo $pointcard['format_updatetime']?></td>
	<td align="center"><?php echo $pointcard['admin_username']?></td>
	<td align="center">
	<?php if ($pointcard['updatetime']<=0) {?>
	<a href="javascript:edit('<?php echo $pointcard['pid']?>', '<?php echo safe_replace($pointcard['card_sn'])?>');void(0);"><?php echo L('edit')?></a>
	<?php }?>&nbsp;&nbsp;
	<?php if ($pointcard['owner_uid']<=0) {?>
	<a href="javascript:bind('<?php echo $pointcard['pid']?>', '<?php echo safe_replace($pointcard['card_sn'])?>');void(0);"><?php echo L('bind')?></a>
	<?php }?>
	</td>
	</tr>
<?php 
	}
}
?>
</tbody>
    </table>
  
</div>
 <div id="pages"><?php echo $this->db->pages;?></div>
</form>
</div>
</body>
</html>
<script type="text/javascript">
function edit(id, title) {
	window.top.art.dialog({id:'edit'}).close();
	window.top.art.dialog({title:'<?php echo L('edit_pointcard')?>--'+title, id:'edit', iframe:'?m=pointcard&c=admin_pointcard&a=edit&pid='+id ,width:'700px',height:'400px'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;
	var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()});
}
function bind(id, title) {
	window.top.art.dialog({id:'bind'}).close();
	window.top.art.dialog({title:'<?php echo L('bind_pointcard')?> -- '+title, id:'bind', iframe:'?m=pointcard&c=admin_pointcard&a=bind&pid='+id ,width:'700px',height:'300px'}, function(){var bd = window.top.art.dialog({id:'bind'}).data.iframe;
	var form = bd.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'bind'}).close()});
}
</script>